#ifndef GX_FR_CUBEMAP_H
#define GX_FR_CUBEMAP_H

#include "Basic/GxLibBasic.h"
#include "LibGL/OpenGL.h"
#include "LibGL/GxMath3D.h"
#include "Basic/Stream.h"

namespace FinalRendering
{
	namespace Engine
	{
		using GxRendering::FrameBufferObject;
		using GxRendering::RenderBuffer;
		using namespace GxLibBasic;

		class Cubemap : public Object
		{
		public:
			enum CubemapType
			{
				Color, Depth
			};
		private:
			RefPtr<FrameBufferObject> fbo;
			RefPtr<RenderBuffer> rb;
		private:
			CubemapType type;
			UInt handle;
			int resolution, internalType;
		public:
			Cubemap(Stream * stream);
			Cubemap(int _resolution, CubemapType _type, int internalType=GL_RGBA);
			~Cubemap();
			int GetResolution();
			CubemapType GetCubemapType();
			void Render(Event<> * renderFunc, const vec3 & p);
			void SaveToStream(Stream * stream);
			void Bind();
		};
	}
}

#endif